package com.example.xd.tuiliu_test.videoplayer.util;



import com.example.xd.tuiliu_test.videoplayer.widget.BasePlayerView;

import java.util.TimerTask;


public class ProgressTimerTask extends TimerTask {
    BasePlayerView playerView;

    public ProgressTimerTask(BasePlayerView playerView) {
        this.playerView = playerView;
    }

    @Override
    public void run() {
        if (playerView.status == playerView.playing || playerView.status == playerView.pause) {
            if (playerView.player == null) {
                return;
            }
            long duration = playerView.player.getDuration();
            long position = playerView.player.getCurrentPosition();
            if (playerView != null) {
                playerView.onProgressUpdate(position, duration);
            }
        }
    }
}
